﻿using System;
using System.Threading;
using System.Windows.Forms;
using G.Runtime;
using GameDesigner.Source.Widgets;
using GameLibrary.Model;

namespace GameDesigner
{
    static class Program
    {
        [STAThread]
        static void Main()
        {
            GameDefExtension.StartExtensions();

            Application.ThreadException += new ThreadExceptionEventHandler(
                Application_ThreadException);
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(
                CurrentDomain_UnhandledException);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Main());
        }

        static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
        {
            Console.WriteLine(e.Exception.StackTrace);
             
            //MessageBox.Show(e.Exception.Message, "Unhandled Thread Exception");
        }

        static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
        {
            MessageBox.Show((e.ExceptionObject as Exception).Message, "Unhandled UI Exception");
        }

    }
}
